<?
require("config.php");

$location_status .= " | Edit";

$show_backnav = "menu";

require($rela_path . "bin/country.php");

$menutype = 2;

if (NULL!=$action){


	$dir = $table . "/";
if ($Picture_name=="" || $Picture_name==NULL) $Picture_name=$old_Picture;

	
	if ($Picture) myUpload($Picture,$Picture_name,$dir);


	if ($remove_Picture=="ture") $Picture_name=NULL;




   $field = array(
	"code",
	"graduate",
	"detail",
	"status",
	"picture1",
	"picture2",
	"picture3",
	"order_index",
"showcase",
	);

   $content = array(
	$Code,
    $Graduate,
	$Detail,
	$Status,
	$Picture_name,
	$Picture2_name,
	$Picture3_name,
	$Order_index,
$showcase,
	);

   $exp = "id='$id'";

   myUpdate($table,$field,$content,$exp);


   header("location:" . $rela_path . "share/msg.php?v=742&id=$parent_id&label=" . $Course);

   exit();

}


$Query = "select 
	code,
	course,
	schedule,
	graduate,
	detail,
	status,
	picture1,
	picture2,
	picture3,
	order_index, showcase 

from $table where id='$id' Limit 1";
$r = myQuery($Query);


	$Code=$r[0][0];
	$Course=$r[0][1];
	$Schedule=$r[0][2];
	$Graduate=$r[0][3];
	$Detail=$r[0][4];
	$Status=$r[0][5];
	$Picture= $r[0][6];
	$Picture2= $r[0][7];
	$Picture3= $r[0][8];
	$Order_index=$r[0][9];
	$showcase=$r[0][10];

require($rela_path . "inc/header.php");
require($rela_path . "bin/date.php");

?>

<form action="" method="post" enctype="multipart/form-data" name="form1">
<!--hidden filed-->
<input name="action" type="hidden" value="edit">
<input name="action" type="hidden" value="edit">
<input name="Code" type="hidden" value="<?print($Code)?>">

<input name="old_Picture_sm" type="hidden" value="<?print($Picture_sm)?>">
<input name="old_Picture" type="hidden" value="<?print($Picture)?>">


  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right"> <input name="image" type="image" onclick="Redirect('menu.php?label=<?=$label?>&id=<?=$parent_id?>',1);return false;" src="../../images/bt_cancel.gif" width="78" height="23"> 
        <input name="image" type="image" src="../../images/bt_save.gif" width="76" height="22"> 
      </td>
    </tr>
  </table>

  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right">&nbsp; </td>
    </tr>
    <tr> 
      <td><table border="0">


          <tr> 
            <td class="tdheader">Course :</td>
            <td>

<?=$Course?>			  </td>
          </tr>



          <tr> 
            <td class="tdheader">Schedule :</td>
            <td>

<?=$Schedule?>  
<input type="hidden" name="parent_id" value="<?=$parent_id?>">			  </td>
          </tr>











          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>Showcase?</td>
            <td>
              <?
$sourceData = array(
1,
0,
);

$sourceLabel = array(
"Yes",
"No",

);

$boxName = "showcase";

FFPRadioBox($boxName,$showcase,$sourceData,$sourceLabel);


?>            </td>
          </tr>
          <tr> 
            <td class="tdheader">Code :</td>
            <td> <?print($Code)?> </td>
          </tr>



          <tr> 
            <td class="tdheader">Order : </td>
            <td><input type="text" class="text" name="Order_index" size="12" value="<?print($Order_index)?>"></td>
          </tr>



          <tr> 
            <td class="tdheader">Graduate :</td>
            <td><input class="text" name="Graduate" type="text" size="40" value="<?=$Graduate?>"></td>
          </tr>
          <tr> 
            <td class="tdheader">Sharing Detail :</td>
            <td><textarea class="text" name="Detail" cols="40" rows="8"><?=$Detail?></textarea></td>
          </tr>


<input name="bk_Picture1" type="hidden" value="<?print($Picture1)?>">
<input name="bk_Picture2" type="hidden" value="<?print($Picture2)?>">
<input name="bk_Picture3" type="hidden" value="<?print($Picture3)?>">

          <tr> 
            <td valign="top" class="tdheader">Publish :</td>
            <td> 
			
              <?

$sourceData = array(
  "Yes",
  "No",
  );

$boxName="Status";

FFPCheckBox("Status",$Status,$sourceData,$sourceLabel);

?>            </td> 			  
          </tr>	
          <tr>
            <td class="tdheader">Picture :</td>
            <td><?loadImage($Picture,$rela_path . $PIC_DIR. $table . "/")?>
                <?removeImage($Picture,"remove_Picture")?>
                <input type="file" class="text" name="Picture" size="45" />
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right"> <input name="image2" type="image" onclick="Redirect('menu.php?label=<?=$label?>&id=<?=$parent_id?>',1);return false;" src="../../images/bt_cancel.gif" width="78" height="23"> 
        <input name="image2" type="image" src="../../images/bt_save.gif" width="76" height="22" <?print($active)?>> 
      </td>
    </tr>
  </table>
</form>
<?
require($rela_path . "inc/footer.php");
?>

